package com.hs.controller;

import com.hs.entity.SysUser;
import com.hs.service.SysUserService;
import com.hs.vo.ResponseModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hs
 * @since 2019-04-29
**/
@Api(tags = {"SysUser操作接口"})
@RestController
@RequestMapping("/sysUser")
public class SysUserController {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private SysUserService sysUserService;

    /**
     * 查询分页数据
     */
    @ApiOperation(value = "查询分页数据")
    @RequestMapping(value = "/list",method = {RequestMethod.POST, RequestMethod.GET})
    public ResponseModel findListByPage(@RequestParam(name = "current", defaultValue = "1") int current,
                                        @RequestParam(name = "size", defaultValue = "20") int size){
        return null;
    }


    /**
     * 根据id查询
     */
    @ApiOperation(value = "根据id查询数据")
    @RequestMapping(value = "/getById",method = {RequestMethod.POST, RequestMethod.GET})
    public ResponseModel getById(@RequestParam("pkid") String pkid){
        SysUser sysUser = sysUserService.getById(pkid);
        return ResponseModel.result("getuserbyid", true, sysUser);
    }

    /**
     * 新增
     */
    @ApiOperation(value = "新增数据")
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ResponseModel add(@RequestBody SysUser sysUser){
        return null;
    }

    /**
     * 批量删除
     */
    @ApiOperation(value = "批量删除数据")
    @RequestMapping(value = "/del",method = RequestMethod.DELETE)
    public ResponseModel delete(@RequestParam("ids") List<String> ids){
        return null;
    }

    /**
     * 修改
     */
    @ApiOperation(value = "更新数据")
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public ResponseModel update(@RequestBody SysUser sysUser){
        return null;
    }

}

